package com.bootdo.web.controller;

import com.bootdo.common.controller.BaseController;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.common.utils.R;
import com.bootdo.work.domain.CarDO;
import com.bootdo.work.domain.OrderDO;
import com.bootdo.work.service.CarService;
import com.bootdo.work.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 
 * 
 * @author admin
 * @email 1992lcg@163.com
 * @date 2021-05-09 21:37:16
 */
 
@Controller
@RequestMapping("/weborder")
public class WebOrderController extends BaseController {
	@Autowired
	private CarService carService;
	@Autowired
	private OrderService orderService;
	
	@GetMapping()
	String Order(Model model){
		model.addAttribute("userid", getUser().getUserId());
		model.addAttribute("username", getUser().getUsername());
		return "web/order";
	}

	@ResponseBody
	@GetMapping("/list")
	/*@RequiresPermissions("work:car:car")*/
	public List listOrder(OrderDO orderDO){
		List<OrderDO> orderList = orderService.weblist(orderDO);
		return orderList;
	}

//	@ResponseBody
//	@GetMapping("/list")
//	/*@RequiresPermissions("work:order:order")*/
//	public PageUtils list(@RequestParam Map<String, Object> params,OrderDO orderDO){
//		//查询列表数据
//		Query query = new Query(params);
//		List<OrderDO> orderList = orderService.weblist(orderDO);
//		int total = orderService.count(query);
//		PageUtils pageUtils = new PageUtils(orderList, total);
//		return pageUtils;
//	}

	@ResponseBody
	@RequestMapping("/update")
	/*@RequiresPermissions("work:car:edit")*/
	public R updateyxbz( OrderDO orderDO){
		orderService.updateyxbz(orderDO);
		return R.ok();
	}
}
